Manager: Memory Manager
Carbon will support the majority of the Memory Manager programming interface. Changes will primarily affect applications that use zones, system memory, or temporary memory. For example, temporary memory allocations in Mac OS X will be allocated in the application's address space. As a result, calling TempNewHandle will effectively be the same as calling NewHandle.
Carbon will not support current functions for accessing the system heap, but Apple will provide new routines to allocate shared and persistent memory. In addition, the virtual memory system in Mac OS X will introduce a number of changes in the addressing model.
The following Memory Manager functions are likely to change in Carbon: GZSaveHnd, MoreMasters, and TempNewHandle.
The following Memory Manager functions are still under evaluation: GetZone, HandleZone, InitZone, PtrZone, SetGrowZone, and SetZone. Please give us feedback on the importance of using subzones in your applications.
The following Memory Manager functions will not be supported in Carbon: MaxBlockSys, MaxMemSys, NewEmptyHandleSys, NewHandleSys, NewHandleSysClear, NewPtrSys, NewPtrSysClear, PurgeMemSys, PurgeSpaceSysContiguous, PurgeSpaceSysTotal, ReallocateHandleSys, RecoverHandleSys, RecoverMemSys, and SystemZone.
The following Virtual Memory functions are likely to change in Carbon: FlushMemory, MakeMemoryNonResident, MakeMemoryResident, and ReleaseMemoryData.
By adhering to the following guidelines, you can increase your application's compliance with Mac OS X memory management:
* Try to use memory only within your own application heap. Review the places where you allocate memory in the system heap.
* Do not pass pointers to data among applications through Apple events, Gestalt routines, or other means. For example, don't share Toolbox data structures between applications, because in Mac OS X, each application will run in its own protected address space.
* Do not use inline, hard-coded addresses.
* Do not use the following Memory Manager functions: EnterSupervisorMode, StripAddress, Translate24To32.
* Do not modify a field in a zone header to specify how many master pointer blocks are allocated by each call to the function MoreMasters. The Memory Manager will supply a new version of the MoreMasters function that allows you to specify the number of master pointer blocks to allocate. Note, however, that master pointer blocks do not need to be preallocated or optimized in the Mac OS X memory model, so the new function will provide the most benefit for applications running on previous versions of the Mac OS.
* Don't make assumptions about the layout of memory, such as the relative position of data stored in heaps, stacks, and other memory areas.
* Don't use the DisposePtr or DisposeHandle functions on pointers or handles allocated by Toolbox managers. For example, don't call the function DisposeHandle on a control allocated with the function NewControl--use DisposeControl instead.
* Because Mac OS X applications will run in a large, protected memory space, memory sizing routines such as MaxMem and FreeMem will work differently than they do now.
ApplicationZone
BlockMove
BlockMoveData
BlockMoveDataUncached
BlockMoveUncached
BlockZero
BlockZeroUncached
CompactMem
CompactMemSys
DebuggerEnter
DebuggerExit
DebuggerGetMax
DebuggerLockMemory
DebuggerPoll
DebuggerUnlockMemory
DeferUserFn
DisposeHandle
DisposePtr
EmptyHandle
EnterSupervisorMode
FlushMemory
FreeMem
FreeMemSys
GetApplLimit
GetHandleSize
GetPageState
GetPhysical
GetPtrSize
GetZone
GZSaveHnd
HandAndHand
HandleZone
HandToHand
HClrRBit
HGetState
HLock
HLockHi
HNoPurge
HoldMemory
HPurge
HSetRBit
HSetState
HUnlock
InitApplZone
InitZone
InlineGetHandleSize
LockMemory
LockMemoryContiguous
LockMemoryForOutput
MakeMemoryNonResident
MakeMemoryResident
MaxApplZone
MaxBlock
MaxBlockSys
MaxMem
MaxMemSys
MemError
MoreMasters
MoreMasters will have a longint parameter for specifying the number of master pointers to allocate in the block. Specifying a number less than 32 will result in 32 master pointers in the allocated block, the current standard allocation.
MoveHHi
NewEmptyHandle
NewEmptyHandleSys
NewHandle
NewHandleClear
NewHandleSys
NewHandleSysClear
NewPtr
NewPtrClear
NewPtrSys
NewPtrSysClear
PageFaultFatal
PtrAndHand
PtrToHand
PtrToXHand
PtrZone
PurgeMem
PurgeMemSys
PurgeSpace
ReallocateHandle
ReallocateHandleSys
RecoverHandle
RecoverHandleSys
ReleaseMemoryData
ReserveMem
ReserveMemSys
SetApplBase
SetApplLimit
SetGrowZone
SetHandleSize
SetPtrSize
SetZone
StackSpace
SystemZone
TempDisposeHandle
TempFreeMem
TempHLock
TempHUnlock
TempMaxMem
TempNewHandle
Temporary memory allocations will actually come from the applications's address space in Mac OS X. However, Carbon applications running under Mac OS 8.x will be able to get true temporary memory.
TempTopMem
TopMem
UnholdMemory
UnlockMemory
[Table of Contents] [Function Index]
Generated on: 2/12/99. Copyright 1998 Apple Computer, Inc. All rights reserved.